let router = require('express').Router();
let {query} = require('../db/utils');


router.get('/react', async function (req, res) {
  let result = await query('react');
  res.json(result);
});

router.get('/Ecmascript', async function (req, res) {
  let result = await query('Ecmascript');
  res.json(result);
});

router.get('/type', async function (req, res) {
  let result = await query();
  let types = [...new Set(result.map(item => item.type))];
  res.json(types);
});


router.get('/vue', async function (req, res) {
  let result = await query('vue');
  res.json(result);
});
router.get('/js', async function (req, res) {
  let result = await query('js');
  res.json(result);
});

router.get('/css', async function (req, res) {
  let result = await query('css');
  res.json(result);
});
router.get('/html', async function (req, res) {
  let result = await query('html');
  res.json(result);
});
module.exports = router;
